package util

import (
	"net"
)

func PortScanner(ip string, port int) (res bool) {
	ipaddr := net.ParseIP(ip)
	tcpaddr := &net.TCPAddr{IP: ipaddr, Port: port}
	conn, err := net.DialTCP("tcp", nil, tcpaddr)
	if err != nil {
		return false
	} else {
		res = true
	}
	defer conn.Close()
	return res
}
